package com.richman.hg;

import com.richman.controller.NegativeRatioClient;

public class HGThread extends Thread {

	public long sleepTime = 30*1000;
	HGManager hgmanager = null;
	
	
	public long lastUpdatetime = 0;
	
	boolean start = false;
	boolean loginNow = false;
	
	
	boolean bexit = false;
	
	public boolean getbexit() {
		return bexit;
	}

	public HGThread(){		

	}
	
	
	@Override
    public void run() {

		try{

			while(NegativeRatioClient.bStartEngine){
				try{

					NegativeRatioClient.mainWnd.updateHGTextArea(NegativeRatioClient.showtext);
					NegativeRatioClient.betCtrMng.keepHGonline();
					
					NegativeRatioClient.betCtrMng.updatehgBetLogData();
					
					NegativeRatioClient.betCtrMng.updatehgSpecialBetLogData();
					
//					SpecialServer.betCtrMng.checkIllegalBet();
//					
//					SpecialServer.betCtrMng.checkSpecialIllegalBet();
					
					
					//暂时注释掉  目前盘口及水位从richman服务器拿到
/*					if(SpecialServer.useForOriginal==false) {
						SpecialServer.betCtrMng.getDanshiPankouAndDaxiao();
					}*/
				
//					
					NegativeRatioClient.betCtrMng.getgameresult();
					
					//DaShuiClient.betCtrMng.getRedcard();
					
					if(NegativeRatioClient.betCtrMng!=null && System.currentTimeMillis() > lastUpdatetime + 10*1000) {
						NegativeRatioClient.betCtrMng.updateBetAdyTable();
						lastUpdatetime = System.currentTimeMillis();
					}
					
					Thread.sleep(500);
					
				}catch(Exception e){
					e.printStackTrace();
					Thread.sleep(2000);
				}
				

			}

			bexit = true;

		}catch(Exception e){
			e.printStackTrace();
		}	
	}
	
}
